<?php
class settingModel extends hopeCmsModel
{

	public static function model($className = __CLASS__)
	{
		return parent::model($className);
	}

	public function tableName()
    {
        return '{setting}';
    }

    public function getSetting()
    {
    	$data = $this->finds();
    	$setting = array();
    	foreach ($data as $d) {
    		$setting[$d['name']] = $d['value'];
    	}
    	unset($data);
    	return $setting;
    }

    public function saveData()
    {
        unset($_POST['token'], $_POST['url_mode'], $_POST['url_suffix'], $_POST['url_route'], $_POST['file404']);
        foreach ($_POST as $name => $value) {
            $this->updates(array('value'=>trim(htmlspecialchars($value))), "name='$name'");
        }
        return true;
    }
}
?>